package com.ruoyi.hotel.domain.converter;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.hotel.domain.Room;
import com.ruoyi.hotel.domain.RoomOrder;
import com.ruoyi.hotel.domain.from.RoomFrom;
import com.ruoyi.hotel.domain.from.RoomOrderFrom;
import com.ruoyi.hotel.domain.vo.RoomOrderVo;
import com.ruoyi.hotel.domain.vo.RoomVo;

import java.util.ArrayList;
import java.util.List;

public class RoomOrderConverter {
    public static RoomOrder converterToPoByFrom(RoomOrderFrom source){
        if (source == null) {
            return null;
        }
        RoomOrder target = new RoomOrder();
        BeanUtil.copyProperties(source, target);
        return target;

    }

    public static List<RoomOrder> converterToPoByFrom(List<RoomOrderFrom> sources){
        if (CollUtil.isEmpty(sources)) {
            return null;
        }
        List<RoomOrder> result=new ArrayList<>();
        for(RoomOrderFrom source: sources){
            RoomOrder target = new RoomOrder();
            BeanUtil.copyProperties(source, target);
            result.add(target);
        }
        return result;

    }


    public static List<RoomOrderVo> converterToVoByPo(List<RoomOrder> sources){
        if (CollUtil.isEmpty(sources)) {
            return null;
        }
        List<RoomOrderVo> result=new ArrayList<>();
        for(RoomOrder source: sources){
            RoomOrderVo target = new RoomOrderVo();
            BeanUtil.copyProperties(source, target);
            result.add(target);
        }
        return result;

    }
}
